package app

import (
	"EREST/common"

	"git.edaijia-inc.cn/edaijia/ego/elogger"
	eloggergin "git.edaijia-inc.cn/edaijia/ego/elogger/gin"

	"github.com/gin-gonic/gin"
)

func Run() {

	conf := common.InitConfig()

	elogger.InitELogger(conf.Log)

	r := gin.New()
	r.Use(eloggergin.GinLoggerMiddleware())
	r.Use(eloggergin.GinRecoveryMiddleware())
	if conf.Env == "prod" {
		gin.SetMode(gin.ReleaseMode)
	}

	common.Init(conf, r)

	Router(r)

	r.Run(conf.HttpAddr)
}
